package com.css.fxfzypg.modules.dataVolumeStatistics.controller;

import com.css.fxfzypg.base.response.RestResponse;
import com.css.fxfzypg.modules.dataVolumeStatistics.service.DataVoLumeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;


/**
 * @author y1fan
 * @description   数据量统计
 */
@RestController
@RequestMapping("/fxfzypg/dataVolume")
@Slf4j
public class DataVolumeController {

    @Resource
    DataVoLumeService dataVoLumeService;

    @GetMapping("/getData")
    public RestResponse getAll() {
        RestResponse response = null;
        try {
            response =dataVoLumeService.getData();
        } catch (Exception e) {
            log.error("查询统计数据失败!", e);
            response = RestResponse.fail("查询统计数据失败!");
        }
        return response;
    }

    /*
    * 简本和详本
    *
    * */
    @PostMapping("/downloadReport")
    public void downloadReport(String ypgId,String flag ,HttpServletResponse res) {
        dataVoLumeService.downloadReport(ypgId,flag,res);
    }

    /***
     * 报告下载
     * @param reportId
     * @param
     * @return
     */
    @PostMapping("/downloadReportXc")
    public void downloadReportXC(String reportId,HttpServletResponse res){
        dataVoLumeService.downloadReportXc(reportId,res);
    }


}
